/**
 * 
 */
package my_first_dao;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Esdras
 *
 */
public class UsuariosDaoImpl implements UsuariosDao {
	
	//list is working as a database
		List<Usuarios> users;

		public UsuariosDaoImpl(){
		      users = new ArrayList<Usuarios>();
		      Usuarios user1 = new Usuarios("Robert",0);
		      Usuarios user2 = new Usuarios("John",1);
		      users.add(user1);
		      users.add(user2);		
		      }
		   
		public void deleteUser(Usuarios user) {
		      users.remove(user.getId());
		      System.out.println("User ID: " + user.getId() 
		         +", deleted from database");
		      }

		//retrive list of users from the database
		public List<Usuarios> getAllUsers() {
		      return users;
		      }

		public Usuarios getUser(int id) {
		      return users.get(id);
		      }

		public void updateUser(Usuarios user) {
		      users.get(user.getId()).setName(user.getName());
		      System.out.println("User ID: " + user.getId() 
		         +", updated in the database");
		      }
		   
		public void addUser(Usuarios user) {
			   
		}
	
}
